# -*- coding: iso-8859-2 -*-

import re
import os

from authorshipanalyzer.file import Path
from authorshipanalyzer.slot.features import Tagger

class TaggerReader:
    '''
    Class reading tags from file
    '''
    
    def read():
        '''
        @return: lst of taggers
        '''
        taggers = []
        
        dir = Path.getResourceDir()
        
        file = open(dir + os.sep + "tags.txt", "r")
        for line in file.readlines():
            line = line.strip()
            
            if line != "":
                parts = line.split(":")
                termList = parts[1].split(",")
                taggers.append(Tagger(parts[0], termList))
                
        file.close()
        return taggers
        
    read = staticmethod(read)
    
if __name__ == "__main__":
    taggers = TaggerReader.read()
    for tagger in taggers:
        print tagger.name,
        print str(tagger.termList)
        